<template name="post">
    <div class="post-detail">
        {{#with post}}
            <div class="post-main">
                <div class="post-header">
                    <div class="post-title">
                        <strong>{{title}}</strong>
                    </div>
                    <div class="desc">
                        <span>{{author}} 发表于 {{fromNow}}</span>
                        <span>浏览 {{visitedCount}} 次</span>
                        <span>评论 {{commentedCount}} 次</span>
                        {{#if equal currentUser._id userId}}
                            <a class="float-right" href="/post/edit/{{_id}}">编辑</a>
                        {{/if}}
                    </div>

                </div>
                <div class="post-body">
                    <p class="mk">
                        {{#markdown}}{{content}}{{/markdown}}
                    </p>
                </div>
            </div>
        {{/with}}
        {{#if comments}}
            <div class="comment-div">
                {{#each comments}}
                    <div class="comment-body">
                        <p class="mk">{{#markdown}}{{content}}{{/markdown}}</p>

                        <div class="desc">
                            <span class="">{{author}} 回复于 {{fromNow}}</span>
                        </div>
                    </div>
                {{/each}}
            </div>
        {{/if}}
        {{#if currentUser}}
            <div class="replay-main">
                <div class="user-edit">
                    <div class='markdown_editor in_editor'>
                    <div class='markdown_in_editor'>
                      <textarea id="editor" class='editor' name='t_content' rows='20' placeholder='文章支持 Markdown 语法, 请注意标记代码'></textarea>
                    </div>
                  </div>
                </div>
                <div class="reply-btn">
                    <button id="btn-comment-submit" type="button" class="btn btn-default">评  论</button>    
                </div>
            </div>
        {{/if}}
    </div>
</template>